import {Component} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {generatePageInfo} from '../../util';

@Component({
  selector: 'app-actor-list',
  templateUrl: './actor-list.component.html',
  styleUrls: ['./actor-list.component.css']
})
export class ActorListComponent {

  pageInfo = {totalElements: 0, data: null, pageCount: 0, pagesArr: Array(0), currentPage: 1, totalPages: 0};

  constructor(private http: HttpClient) {
    this.changePage(1);
  }

  changePage(i: number) {
    this.http.get(`/person/allProfession/vo/list?page=${i}&size=6`, {observe: 'response'}).subscribe(result => {
      generatePageInfo(this.pageInfo, result);
    });
  }

}
